package com.jy.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jy.mapper.CarMapper;
import com.jy.mapper.TypeMapper;
import com.jy.pojo.Car;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class CarService extends ServiceImpl<CarMapper, Car> implements IService<Car> {
    @Autowired
    CarMapper carMapper;
    @Autowired
    TypeMapper typeMapper;

    public Page<Car> findPage(Integer pn, Integer ps, Car car) {
        Page<Car> page = new Page<>(pn, ps);
        return carMapper.findPage(page, car);
    }

    public List<Car> findAll() {
        return carMapper.findAll();
    }

    public Integer findIdByTname(String tname) {
        return typeMapper.findIdByTname(tname);
    }

    public List<Map> findCount() {
        return carMapper.findCount();
    }
}
